<?php
/**
 * Class descript.
 * User: chan
 * Date: 2017/10/26 15:29
 */
namespace app\api\controller;
use think\Db;

class Member extends Base
{
    /**
     * 获取会员信息
     */
    public function getMember()
    {
        $input = input();
        if (empty($input['uid'])){
            return $this->ajaxReturn('',-1,'未定义uid');
        }
    /*    $where = [
            'uid' => $input['uid'],
            'level' => 2
        ];*/
        $data = db('member')->select();
        $level = db('user_account')->where(['id' => $input['uid']])->value('level');
        $data['member_level'] = $level;
        return $this->ajaxReturn($data);
    }

    /**
     * 升级会员
     */
    public function addMember()
    {
        // $input = input();;
        // if (empty($input['uid'])){
        //     return $this->ajaxReturn('',-1,'未定义uid');
        // }
        // if (empty($input['price'])){
        //     return $this->ajaxReturn('',-1,'未定义price');
        // }
        // if (empty($input['level'])){
        //     return $this->ajaxReturn('',-1,'未定义level');
        // }
        // $data = [];
        // $data['uid'] = $input['uid'];
        // $data['price'] = $input['price'];
        // $data['level'] = $input['level'];
        // $data['recommend_id'] = empty($input['recommend_id']) ? '' : $input['recommend_id'];
        // $data['created_at'] = time();
        // $id = db('member_info')->insertGetId($data);
        // return $this->ajaxReturn($data);
    }

}